package com.ciaojian.core.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ciaojian.core.model.HairArchiveImg;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author oxiny
 */
public interface HairArchiveImgMapper extends BaseMapper<HairArchiveImg> {

    /**
     * 根据档案ID查询
     *
     * @param archiveId 档案ID
     * @return /
     * @see com.ciaojian.core.mapper.HairArchiveMapper#pageByUid(Page, Integer)
     */
    @Select("SELECT * FROM d_hair_archive_img WHERE archive_id = #{archiveId} AND deleted = 0")
    List<HairArchiveImg> listByArchiveId(@Param("archiveId") Integer archiveId);
    /**
     * 用户最近发型
     * 3张
     *
     * @param userId /
     * @return /
     */
    @MapKey("id")
    List<Map<String, Object>> recurrently(@Param("userId") Integer userId);

    /**
     * 用户收藏图片
     *
     * @param userId 用户ID
     * @return /
     */
    @MapKey("id")
    List<Map<String, Object>> listFavorite(@Param("userId") Integer userId);

    /**
     * 批量插入
     *
     * @param hairArchiveImgList 档案图片列表
     * @return /
     */
    Integer insertBatch(@Param("list") List<HairArchiveImg> hairArchiveImgList);
}
